//
//  FileDownload.h
//  iengage
//
//  Created by Luis Ziliani on 2/12/09.
//  Copyright 2009 Manas. All rights reserved.
//

#import <Foundation/Foundation.h>

@protocol HttpRequestDelegate

- (void) informUnkownError;
- (void) informError: (NSString*) error;
- (void) showPreferencesCredentialsAreIncorrect;
- (void) requestEndedOk;
@end


@interface HttpRequestWithLogin : NSObject {

	id<HttpRequestDelegate> delegate;
	NSString *user;
	NSString *password;

	@private
	bool errorOccured;

}

@property (retain) NSString* user;
@property (retain) NSString* password;

- (void) openURL:(NSString *) url withUser:(NSString *)usr andPassword:(NSString *) pass delegate:(id<HttpRequestDelegate>) dlg;

- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response;

- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data;

- (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error;

- (void)connectionDidFinishLoading:(NSURLConnection *)connection;

-(void)connection:(NSURLConnection *)connection didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge;

@end
